package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: anubhav
 * Date: 1/3/14
 * Time: 8:09 PM
 * To change this template use File | Settings | File Templates.
 */
public class BookListGenerator implements Action {

    private ArrayList<Book> bookList;
    private PrintStream out;

    public BookListGenerator(ArrayList<Book> list, PrintStream out) {
        bookList = list;
        this.out = out;
    }

    @Override
    public void executeAction() {

        for (int i = 0; i < bookList.size(); i++) {
            out.println(i + 1 + ". " + bookList.get(i).getName());
        }
    }
}
